﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Code.Models
{
    /// <summary>
    /// 站点设置的枚举
    /// </summary>
    public enum Option_Site_Key
    {
        #region 用户相关

        /// <summary>
        /// 每天最大提款次数
        /// </summary>
        User_MaxTakeMoneyCount,
        /// <summary>
        /// 每次最小提款金额
        /// </summary>
        User_MinTakeMoney,

        /// <summary>
        /// 提款开始时间
        /// </summary>
        Site_Service_TakeMoneyStartTime,
        /// <summary>
        /// 提款终止时间
        /// </summary>
        Site_Service_TakeMoneyEndTime,
        /// <summary>
        /// 是否开启代理给下级充值
        /// </summary>
        User_CanAddSubMoney,

        /// <summary>
        /// 是否开启声音模式
        /// </summary>

        Site_Sounds_Enable,
        #endregion


        #region 彩票设置


        /// <summary>
        /// 追号最大期数,默认:400
        /// </summary>
        User_MaxChaseTaskMun,
        /// <summary>
        /// 出票延迟时间，用小数表示秒:0.5为30秒,默认:0
        /// </summary>
        Site_Lottery_OutBill_Delay,
        /// <summary>
        /// 使用站点设置的奖金来派奖
        /// </summary>
        Site_Lottery_UseSiteWinMoney,
        /// <summary>
        /// 最小返奖金差间隔比率,默认:0
        /// </summary>
        Site_Lottery_MinBackWinMoneyMarginRatio,
        /// <summary>
        /// 最大反奖差间隔比率,默认:100
        /// </summary>
        Site_Lottery_MaxBackWinMoneyMarginRatio,
        /// <summary>
        /// 最低保障金额比率,默认:0
        /// </summary>
        Site_Lottery_MinWinMoneyRatio,
        /// <summary>
        /// 使用站点设置的返点
        /// </summary>
        Site_Lottery_UseSiteBackMoneyRatio,
        /// <summary>
        /// 最小返点间隔,默认:0
        /// </summary>
        Site_Lottery_MinBackMoneyMarginRatio,
        /// <summary>
        /// 最大返点间隔,默认:100
        /// </summary>
        Site_Lottery_MaxBackMoneyMarginRatio,
        /// <summary>
        /// 有关返点的设置
        /// </summary>
        Site_Lottery_BackMoneyRatio,
        /// <summary>
        /// 最低保障返点,默认:0
        /// </summary>
        Site_Lottery_MinBackMoneyRatio,
        /// <summary>
        /// 代理可设置的最高反点比列
        /// </summary>
        Site_Lottery_Member_MaxBackMoneyRatio,
        /// <summary>
        /// 彩票购买协议
        /// </summary>
        Site_Lottery_BetProtocol,
        /// <summary>
        /// 号码限制不通过时的提示
        /// </summary>
        Site_Lottery_BetError,
        /// <summary>
        /// 是否自动撤消过期方案
        /// </summary>
        Site_Lottery_AutoCancleTimeOutScheme,
        /// <summary>
        /// 是否自动撤消过期追号任务
        /// </summary>
        Site_Lottery_AutoCancleTimeOutChaseTask,
        /// <summary>
        /// 是否启用返点加奖功能
        /// </summary>
        Site_BackMoneyToWinMoney_Enable,
        /// <summary>
        /// 返点加奖 返点最小单位
        /// </summary>
        Site_BackMoneyToWinMoney_Step,

        #endregion


        #region 系统设置

        /// <summary>
        /// 是否启用点卡充值
        /// </summary>
        Site_CardPay_Enable,

        /// <summary>
        /// 是否启用配额设置
        /// </summary>
        Site_AddChildConfig_Enable,

        /// <summary>
        /// 平台ID
        /// </summary>
        Site_SiteID,

        /// <summary>
        /// 最小充值金额
        /// </summary>
        Site_AddMoney_Min,

        /// <summary>
        /// 系统公告每页条数,默认:5
        /// </summary>
        Site_Notice_HomeCount,

        /// <summary>
        /// 分页时默认每页显示条数
        /// </summary>
        Site_PageInfo_PageCount,


        /// <summary>
        /// 邮件服务器的端品
        /// </summary>
        Site_MailServer_Port,
        /// <summary>
        /// 邮件服务器的登录名
        /// </summary>
        Site_MailServer_UserName,
        /// <summary>
        /// 邮件服务器的登录密码
        /// </summary>
        Site_MailServer_Password,
        /// <summary>
        /// 邮件服务器的地址
        /// </summary>
        Site_MailServer_ServerAddr,
        /// <summary>
        /// 是否启用邮件发送功能
        /// </summary>
        Site_MailServer_Enable,


        /// <summary>
        /// 联系信箱
        /// </summary>
        Site_Info_Email,
        /// <summary>
        /// 网站域名(如有特殊端口也要加上)
        /// </summary>
        Site_Info_Dns,
        /// <summary>
        /// 联系电话
        /// </summary>
        Site_Info_Tel,
        /// <summary>
        /// 传真
        /// </summary>
        Site_Info_Fax,
        /// <summary>
        /// 公司名称
        /// </summary>
        Site_Info_Company,
        /// <summary>
        /// 公司简介
        /// </summary>
        Site_Info_Description,



        /// <summary>
        /// 清除数据的密码
        /// </summary>
        Site_Other_ClearDataPwd,
        /// <summary>
        /// 清除数据的密码
        /// </summary>
        Site_Other_SetPayPwd,



        /// <summary>
        /// 系统设置缓存时间，用小数表示秒:0.5为30秒,默认:1
        /// </summary>
        Site_Cache_OptionsTime,
        /// <summary>
        /// 彩种缓存时间，用小数表示秒:0.5为30秒,默认:1
        /// </summary>
        Site_Cache_LotteryTime,
        /// <summary>
        /// 玩法缓存时间，用小数表示秒:0.5为30秒,默认:1
        /// </summary>
        Site_Cache_PlayListTime,
        /// <summary>
        /// 彩种玩法缓存时间，用小数表示秒:0.5为30秒,默认:1
        /// </summary>
        Site_Cache_PlayTypeTime,
        /// <summary>
        /// 消费比例缓存时间，用小数表示秒:0.5为30秒,默认:1
        /// </summary>
        Site_Cache_RatioTime,
        /// <summary>
        /// 奖金模式缓存时间，用小数表示秒:0.5为30秒,默认:1
        /// </summary>
        Site_Cache_WinModelTime,
        /// <summary>
        /// 权限设置缓存时间,用小数表示秒:0.5为30秒，默认：1
        /// </summary>
        Site_Cache_AuthenticationTime,
        /// <summary>
        /// 系统公告缓存时间,用小数表示秒:0.5为30秒,默认:1
        /// </summary>
        Site_Cache_NoticeTime,
        /// <summary>
        /// 刷新提款申请的缓存时间，用小数表示秒:0.5为30秒,默认:1
        /// </summary>
        Site_Cache_TakeMoneyTime,
        /// <summary>
        /// 是否启用代理设置下级模式
        /// </summary>
        Site_Cache_WinMoneyTypeID,
        /// <summary>
        /// 是否开启等级
        /// </summary>
        Site_Cache_Rating,
        /// <summary>
        /// 多少钱换一点经验
        /// </summary>
        Site_Cache_ChangeExp,
        #endregion

        /* 支付平台设置
         * ***********************/
        #region 支付平台

        /// <summary>
        /// 易宝支付接口地址
        /// </summary>
        Site_Pay_YeePay_ReqUrl,
        /// <summary>
        /// 易宝支付 商户ID
        /// </summary>
        Site_Pay_YeePay_MerhantID,
        /// <summary>
        /// 易宝支付 商户密钥(加密之后的)
        /// </summary>
        Site_Pay_YeePay_Key,
        /// <summary>
        /// 是否使用易宝支付接口
        /// </summary>
        Site_Pay_YeePay_Enable,


        /// <summary>
        /// 是否使用支付宝接口
        /// </summary>
        Site_Pay_AliPay_Enable,
        /// <summary>
        /// 支付宝 商户ID
        /// </summary>
        Site_Pay_AliPay_MerhantID,
        /// <summary>
        /// 支付宝 商户密钥(加密之后的)
        /// </summary>
        Site_Pay_AliPay_Key,
        /// <summary>
        /// 支付宝 接口地址
        /// </summary>
        Site_Pay_AliPay_ReqUrl,
        /// <summary>
        /// 支付宝账户
        /// </summary>
        Site_Pay_AliPay_Email,


        /// <summary>
        /// 是否使用财付通接口
        /// </summary>
        Site_Pay_TenPay_Enable,
        /// <summary>
        /// 财付通 商户ID
        /// </summary>
        Site_Pay_TenPay_MerhantID,
        /// <summary>
        /// 财付通 商户密钥(加密之后的)
        /// </summary>
        Site_Pay_TenPay_Key,
        /// <summary>
        /// 财付通 接口地址
        /// </summary>
        Site_Pay_TenPay_ReqUrl,
        /// <summary>
        /// 财付通 商户名
        /// </summary>
        Site_Pay_TenPay_Name,


        /// <summary>
        /// 是否使用工商银行转账充值功能
        /// </summary>
        Site_Pay_ICBC_Manual_Enable,
        /// <summary>
        /// 工商银行受理账户名
        /// </summary>
        Site_Pay_ICBC_Manual_MemberName,
        /// <summary>
        /// 工商银行受理账户号
        /// </summary>
        Site_Pay_ICBC_Manual_MemberID,

        /// <summary>
        /// 工商银行转账充值说明
        /// </summary>
        Site_Pay_ICBC_Manual_Memo,
        /// <summary>
        /// 工商银行 转账手续费率
        /// </summary>
        Site_Pay_ICBC_Manual_ChargeRatio,
        /// <summary>
        /// 工商银行 转账最小手续费
        /// </summary>
        Site_Pay_ICBC_Manual_MinCharge,
        /// <summary>
        /// 工商银行 转账最大手续费
        /// </summary>
        Site_Pay_ICBC_Manual_MaxCharge,

        /// <summary>
        /// 是否使用财付通转账充值功能
        /// </summary>
        Site_Pay_TenPays_Manual_Enable,
        /// <summary>
        /// 财付通受理账户名
        /// </summary>
        Site_Pay_TenPays_Manual_MemberName,
        /// <summary>
        /// 财付通受理账户号
        /// </summary>
        Site_Pay_TenPays_Manual_MemberID,

        /// <summary>
        /// 财付通转账充值说明
        /// </summary>
        Site_Pay_TenPays_Manual_Memo,
        /// <summary>
        /// 财付通 转账手续费率
        /// </summary>
        Site_Pay_TenPays_Manual_ChargeRatio,
        /// <summary>
        /// 财付通 转账最小手续费
        /// </summary>
        Site_Pay_TenPays_Manual_MinCharge,
        /// <summary>
        /// 财付通 转账最大手续费
        /// </summary>
        Site_Pay_TenPays_Manual_MaxCharge,

        /// <summary>
        /// 是否使用支付宝转账充值功能
        /// </summary>
        /// 
       Site_Pay_Alipays_Manual_Enable,
        /// <summary>
        /// 支付宝受理账户名
        /// </summary>
       Site_Pay_Alipays_Manual_MemberName,
        /// <summary>
        /// 支付宝受理账户号
        /// </summary>
        Site_Pay_Alipays_Manual_MemberID,

        /// <summary>
        /// 支付宝转账充值说明
        /// </summary>
        Site_Pay_Alipays_Manual_Memo,
        /// <summary>
        /// 支付宝 转账手续费率
        /// </summary>

        Site_Pay_Alipays_Manual_ChargeRatio,
        /// <summary>
        /// 支付宝 转账最小手续费
        /// </summary>
        Site_Pay_Alipays_Manual_MinCharge,
        /// <summary>
        /// 支付宝 转账最大手续费
        /// </summary>
        Site_Pay_Alipays_Manual_MaxCharge,
        #region 转账接口
        /// <summary>
        /// 支付宝转账户名
        /// </summary>
        Site_Pay_AliPay_Manual_MemberName,
        /// <summary>
        /// 支付宝转账账户
        /// </summary>
        Site_Pay_AliPay_Manual_MemberID,
        /// <summary>
        /// 财富通转账户名
        /// </summary>
        Site_Pay_TenPay_Manual_MemberName,
        /// <summary>
        /// 财富通转账账户
        /// </summary>
        Site_Pay_TenPay_Manual_MemberID,
        #endregion
        #endregion
    }
    /// <summary>
    /// 控件的类型
    /// </summary>
    public enum ControlType
    {
        TextBox,
        DropDowList,
        RidoButton,
        CheckBox,
        Password,
        TextArea,

        HtmlBox,
    }

    public static class Option_Site_KeyEx
    {
         /// <summary>
        /// 是否在另外的页面设置
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public static bool ShowOtherPage(this Option_Site_Key key)
        {
            switch (key)
            {
                case Option_Site_Key.Site_Lottery_MaxBackMoneyMarginRatio:
                case Option_Site_Key.Site_Lottery_Member_MaxBackMoneyRatio:
                case Option_Site_Key.Site_Lottery_MinBackMoneyMarginRatio:
                case Option_Site_Key.Site_Lottery_MinBackMoneyRatio:
                    return true;
                default:
                    return key.ToString().StartsWith("Site_Pay_") || key.ToString().StartsWith("Site_Other_");
            }
        }
        /// <summary>
        /// 站点设置枚举的详情
        /// </summary>
        public class Option_Site_KeyDetail
        {
            public Option_Site_KeyDetail(ControlType type, string name, string remark, bool isNull, Func<string, bool> valid)
            {
                this.Type = type;
                this.Name = name;
                this.Remark = remark;
                this.IsNull = isNull;
                this.Valid = valid;
            }
            public ControlType Type { get; set; }
            public string Name { get; set; }
            public string Remark { get; set; }
            /// <summary>
            ///  是否可以为空
            /// </summary>
            public bool IsNull { get; set; }

            /// <summary>
            /// 验证值的格式是否正确
            /// </summary>
            public Func<string, bool> Valid { get; set; }
        }
        public static object ToObject(this Option_Site_Key key, string value)
        {
            switch (key)
            {
                case Option_Site_Key.User_MaxTakeMoneyCount:
                case Option_Site_Key.User_MinTakeMoney:
                case Option_Site_Key.User_MaxChaseTaskMun:
                case Option_Site_Key.Site_Notice_HomeCount:
                case Option_Site_Key.Site_PageInfo_PageCount:
                    int num;
                    if (int.TryParse(value, out num))
                        return num;
                    return null;
                case Option_Site_Key.Site_Cache_OptionsTime:
                case Option_Site_Key.Site_Cache_LotteryTime:
                case Option_Site_Key.Site_Cache_PlayListTime:
                case Option_Site_Key.Site_Cache_PlayTypeTime:
                case Option_Site_Key.Site_Cache_RatioTime:
                case Option_Site_Key.Site_Cache_WinModelTime:
                case Option_Site_Key.Site_Cache_AuthenticationTime:
                case Option_Site_Key.Site_Cache_NoticeTime:
                case Option_Site_Key.Site_Cache_TakeMoneyTime:
                case Option_Site_Key.Site_Lottery_OutBill_Delay:
                case Option_Site_Key.Site_Lottery_MinWinMoneyRatio:
                case Option_Site_Key.Site_Lottery_MaxBackWinMoneyMarginRatio:
                case Option_Site_Key.Site_Lottery_MinBackMoneyRatio:
                case Option_Site_Key.Site_Lottery_MaxBackMoneyMarginRatio:
                case Option_Site_Key.Site_Lottery_Member_MaxBackMoneyRatio:
                case Option_Site_Key.Site_Lottery_MinBackMoneyMarginRatio:
                case Option_Site_Key.Site_Lottery_MinBackWinMoneyMarginRatio:
                case Option_Site_Key.Site_AddMoney_Min:
                case Option_Site_Key.Site_Pay_ICBC_Manual_ChargeRatio:
                case Option_Site_Key.Site_Pay_ICBC_Manual_MinCharge:
                case Option_Site_Key.Site_Pay_ICBC_Manual_MaxCharge:
                    double num1;
                    if (double.TryParse(value, out num1))
                        return num1;
                    return null;
                default:
                    return value;
            }
        }
        /// <summary>
        /// 获取当前枚举的详情
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public static Option_Site_KeyDetail GetDetail(this Option_Site_Key key)
        {
            switch (key)
            {
                case Option_Site_Key.User_MaxTakeMoneyCount:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "每天最大提款次数", " ", true, p => Rang_int(p, 0, null));
                case Option_Site_Key.User_MinTakeMoney:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "每次最小提款金额", " ", true, p => Rang_int(p, 0, null));
                case Option_Site_Key.User_MaxChaseTaskMun:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "追号最大期数", "默认:400", true, p => Rang_int(p, 0, null));
                case Option_Site_Key.User_CanAddSubMoney:
                    return new Option_Site_KeyDetail(ControlType.CheckBox, "开启代理为下级充值功能", " ", true, _Bool);
                case Option_Site_Key.Site_Cache_OptionsTime:
                    return new Option_Site_KeyDetail(ControlType.TextBox, " 系统设置缓存时间", "用小数表示秒:0.5为30秒:默认:1", true, p => Rang_double(p, 0, null));
                case Option_Site_Key.Site_Cache_LotteryTime:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "彩种缓存时间", "用小数表示秒:0.5为30秒:默认:1", true, p => Rang_double(p, 0, null));
                case Option_Site_Key.Site_Cache_PlayListTime:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "玩法缓存时间", "用小数表示秒:0.5为30秒:默认:1", true, p => Rang_double(p, 0, null));
                case Option_Site_Key.Site_Cache_PlayTypeTime:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "彩种玩法缓存时间", "用小数表示秒:0.5为30秒:默认:1", true, p => Rang_double(p, 0, null));
                case Option_Site_Key.Site_Cache_RatioTime:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "消费比例缓存时间", "用小数表示秒:0.5为30秒:默认:1", true, p => Rang_double(p, 0, null));
                case Option_Site_Key.Site_Cache_WinModelTime:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "奖金模式缓存时间", "用小数表示秒:0.5为30秒:默认:1", true, p => Rang_double(p, 0, null));
                case Option_Site_Key.Site_Cache_AuthenticationTime:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "权限设置缓存时间", "用小数表示秒:0.5为30秒，默认：1", true, p => Rang_double(p, 0, null));
                case Option_Site_Key.Site_Cache_NoticeTime:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "系统公告缓存时间", "用小数表示秒:0.5为30秒，默认：1", true, p => Rang_double(p, 0, null));
                case Option_Site_Key.Site_Cache_TakeMoneyTime:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "刷新提款申请的缓存时间", "用小数表示秒:0.5为30秒,默认:1", true, p => Rang_double(p, 0, null));

                case Option_Site_Key.Site_CardPay_Enable:
                    return new Option_Site_KeyDetail(ControlType.CheckBox, "是否启用点卡充值", null, true, _Bool);
                case Option_Site_Key.Site_AddChildConfig_Enable:
                    return new Option_Site_KeyDetail(ControlType.CheckBox, "是否启用配额设置", "配额设置用于限制代理添加用户多少", true, _Bool);

                case Option_Site_Key.Site_AddMoney_Min:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "最小充值金额", "限制用户每次至少要充的金额", true, p => Rang_double(p, 0, null));
                case Option_Site_Key.Site_SiteID:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "平台的ID", "用于标识平台，推荐使用英文字母", true, p => true);
                case Option_Site_Key.Site_PageInfo_PageCount:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "每页条数", "分页时每页默认显示的条数(可不填写)", true, p => true);

                case Option_Site_Key.Site_Info_Company:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "公司名称", null, true, p => true);
                case Option_Site_Key.Site_Info_Email:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "联系信箱", null, true, p => true);
                case Option_Site_Key.Site_Info_Fax:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "传真号码", null, true, p => true);
                case Option_Site_Key.Site_Info_Tel:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "联系电话", null, true, p => true);
                case Option_Site_Key.Site_Info_Dns:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "网站地址", null, true, p => true);
                case Option_Site_Key.Site_Info_Description:
                    return new Option_Site_KeyDetail(ControlType.HtmlBox, "公司简介", null, true, p => true);

                case Option_Site_Key.Site_Notice_HomeCount:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "前台公告显示条数", "默认:5", true, p => Rang_int(p, 1, null));
                case Option_Site_Key.Site_Service_TakeMoneyStartTime:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "提款申请启始时间", "不填则不限制,格式9:00", true, p => string.Format("{0:yyyy-MM-dd} {1}", DateTime.Now, p).IsDateTime());
                case Option_Site_Key.Site_Service_TakeMoneyEndTime:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "提款申请结束时间", "格式23:00", true, p => string.Format("{0:yyyy-MM-dd} {1}", DateTime.Now, p).IsDateTime());

                case Option_Site_Key.Site_Lottery_OutBill_Delay:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "出票延迟时间", "用小数表示秒:0.5为30秒:默认:0", true, p => Rang_double(p, 0, null));
                case Option_Site_Key.Site_Lottery_MinWinMoneyRatio:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "最低保障金额比率", "%，默认:0", true, p => Rang_double(p, 0, 100));
                case Option_Site_Key.Site_Lottery_MaxBackWinMoneyMarginRatio:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "最大反奖间隔比率", "%，默认:100", true, p => Rang_double(p, 0, 100));
                case Option_Site_Key.Site_Lottery_MinBackMoneyRatio:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "最低保障返点", "默认:0", true, p => Rang_double(p, 0, 100));
                case Option_Site_Key.Site_Lottery_MaxBackMoneyMarginRatio:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "最大返点间隔", "默认:100", true, p => Rang_double(p, 0, 100));
                case Option_Site_Key.Site_Lottery_MinBackMoneyMarginRatio:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "最小返点间隔", "默认：0", true, p => Rang_double(p, 0, 100));
                case Option_Site_Key.Site_Lottery_MinBackWinMoneyMarginRatio:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "最小返奖间隔比率", "%，默认：0", true, p => Rang_double(p, 0, 100));
                case Option_Site_Key.Site_Lottery_Member_MaxBackMoneyRatio:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "前台可设置的最大反点", "默认:100", true, p => Rang_double(p, 0, 100));
                case Option_Site_Key.Site_Lottery_BackMoneyRatio:
                    return new Option_Site_KeyDetail(ControlType.HtmlBox, "返点的设置", null, true, p => true);
                case Option_Site_Key.Site_Lottery_BetProtocol:
                    return new Option_Site_KeyDetail(ControlType.HtmlBox, "彩票购买协议", null, true, p => true);
                case Option_Site_Key.Site_Lottery_BetError:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "认购号码被限制", "号码限制不通过时的提示", true, p => true);
                case Option_Site_Key.Site_Lottery_AutoCancleTimeOutChaseTask:
                    return new Option_Site_KeyDetail(ControlType.CheckBox, "撤销过期任务", "自动撤消过期未执行的追号任务", true, _Bool);
                case Option_Site_Key.Site_Lottery_AutoCancleTimeOutScheme:
                    return new Option_Site_KeyDetail(ControlType.CheckBox, "撤销过期方案", "自动撤消过期未开奖的方案", true, _Bool);
                case Option_Site_Key.Site_Lottery_UseSiteWinMoney:
                    return new Option_Site_KeyDetail(ControlType.CheckBox, "使用系统设置的奖金", "所有用户使用站点设置的奖金来派奖", true, _Bool);
                case Option_Site_Key.Site_Lottery_UseSiteBackMoneyRatio:
                    return new Option_Site_KeyDetail(ControlType.CheckBox, "使用系统设置的返点", "所有用户使用站点设置的返点", true, _Bool);
                case Option_Site_Key.Site_BackMoneyToWinMoney_Enable:
                    return new Option_Site_KeyDetail(ControlType.CheckBox, "返点加奖功能启用", null, true, _Bool);
                case Option_Site_Key.Site_BackMoneyToWinMoney_Step:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "返点加奖功能最少刻度", "返点的最小单位", true, _Double);


                case Option_Site_Key.Site_MailServer_Enable:
                    return new Option_Site_KeyDetail(ControlType.CheckBox, "启用邮件发送", "", true, _Bool);
                case Option_Site_Key.Site_MailServer_ServerAddr:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "邮件服务器地址", "", true, p => true);
                case Option_Site_Key.Site_MailServer_Port:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "邮件服务器端口", "默认:25", true, _Int);
                case Option_Site_Key.Site_MailServer_Password:
                    return new Option_Site_KeyDetail(ControlType.Password, "邮件服务器登录密码", "不输入为不更改", true, p => true);
                case Option_Site_Key.Site_MailServer_UserName:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "邮件服务器登录名", "", true, p => true);

                case Option_Site_Key.Site_Cache_WinMoneyTypeID:
                    return new Option_Site_KeyDetail(ControlType.CheckBox, "启用代理为下级设置模式", null, true, _Bool);
                case Option_Site_Key.Site_Sounds_Enable:
                    return new Option_Site_KeyDetail(ControlType.CheckBox, "是否开启提款提示音", null, true, _Bool);
                case Option_Site_Key.Site_Cache_Rating:
                    return new Option_Site_KeyDetail(ControlType.CheckBox, "是否开启等级功能", null, true, _Bool);
                case Option_Site_Key.Site_Cache_ChangeExp:
                    return new Option_Site_KeyDetail(ControlType.TextBox, "多少钱换取一经验", "", true,p=>true);
                default:
                    return new Option_Site_KeyDetail(ControlType.TextBox, key.ToString(), "", true, p => true);
            }
        }

        private static Func<string, bool> _Bool = p => p.IsBool();
        private static Func<string, bool> _Double = p => p.IsDouble();
        private static Func<string, bool> _Int = p => p.IsInt();
        private static Func<string, bool> _DateTime = p => p.IsDateTime();
        private static Func<string, double?, double?, bool> Rang_double = (p, p1, p2) =>
            {
                double d;
                if (double.TryParse(p, out d))
                {
                    var flag = true;
                    if (p1.HasValue)
                        flag = d >= p1.Value;
                    if (p2.HasValue)
                        flag = flag && d <= p2.Value;
                    return flag;
                } return false;
            };
        private static Func<string, int?, int?, bool> Rang_int = (p, p1, p2) =>
            {
                int d;
                if (int.TryParse(p, out d))
                {
                    var flag = true;
                    if (p1.HasValue)
                        flag = d >= p1.Value;
                    if (p2.HasValue)
                        flag = flag && d <= p2.Value;
                    return flag;
                } return false;
            };
        private static Func<string, DateTime?, DateTime?, bool> Rang_DateTime = (p, p1, p2) =>
            {
                DateTime d;
                if (DateTime.TryParse(p, out d))
                {
                    var flag = true;
                    if (p1.HasValue)
                        flag = d >= p1.Value;
                    if (p2.HasValue)
                        flag = flag && d <= p2.Value;
                    return flag;
                } return false;
            };
    }
}
